home *** CD-ROM | disk | FTP | other *** search
Wrap
VERSION 2.00 Begin Form frmMainForm BackColor = &H00C0C0C0& Caption = "TMS 'Exploding Form' Demo" ClientHeight = 1572 ClientLeft = 3264 ClientTop = 3780 ClientWidth = 3960 Height = 2316 Icon = BLOWMAIN.FRX:0000 Left = 3216 LinkTopic = "Form1" ScaleHeight = 1572 ScaleWidth = 3960 Top = 3084 Width = 4056 Begin MsgBlaster MsgBlaster1 Prop8 = "Click on ""..."" for the About Box ---->" End Begin Label lblDummy Alignment = 2 'Center AutoSize = -1 'True BackStyle = 0 'Transparent BorderStyle = 1 'Fixed Single Caption = "Minimise/Resize/Maximise For Demo and 'Help', 'Contents' for Explanation." FontBold = 0 'False FontItalic = 0 'False FontName = "MS Sans Serif" FontSize = 7.8 FontStrikethru = 0 'False FontUnderline = 0 'False Height = 408 Left = 120 TabIndex = 0 Top = 120 Width = 3732 WordWrap = -1 'True End Begin Label labDesignNote Alignment = 2 'Center AutoSize = -1 'True BackColor = &H00FF0000& BorderStyle = 1 'Fixed Single Caption = "The 'dynamite' control at the top left of this form is a 'Message Blaster' control. This is not visible at runtime and is used to detect/intercept Windows' messages sent to the form at runtime." FontBold = 0 'False FontItalic = 0 'False FontName = "MS Sans Serif" FontSize = 7.8 FontStrikethru = 0 'False FontUnderline = 0 'False ForeColor = &H0000FFFF& Height = 852 Left = 120 TabIndex = 1 Top = 600 Visible = 0 'False Width = 3732 WordWrap = -1 'True End Begin Menu mnuHelp Caption = "&Help" Begin Menu mnuHelpContents Caption = "&Contents" End Begin Menu mnuHelpSep1 Caption = "-" End Begin Menu mnuHelpAbout Caption = "&About TMS Exploding Form Application..." End End '******************************************************************************* ' The Mandelbrot Set (International) Ltd. may be reached by the following means: ' CIS: 100016,2751 ' Internet 100016.2751@Compuserve.com ' FAX: (+44) 01451 860142. ' Telephone: (+44) 0941 117534. ' TMS accepts no liability whatsoever for this code or demonstration. '******************************************************************************* '========================================================== ' Module - BLOWMAIN.FRM ' Module Prefix - None ' Author - Peter J. Morris. TMS Ltd. ' Date Written : #### Date - 16/11/94 Time - 03:11 ' Purpose - Example of how to use API for VBITS talk. ' Revisions ' BY WHY AFFECTED ' Peter J. Morris. TMS Ltd. Original code. '========================================================== Option Explicit '========================================================== ' Function - Form_Load ' Author - Peter J. Morris. TMS Ltd. ' Date Written: #### Date - 16/11/94 Time - 03:11 ' Purpose - See function purpose. ' Revisions: ' BY WHY AFFECTED ' Peter J. Morris. TMS Ltd. Original code. ' INPUTS - None ' OUTPUTS - None '========================================================== Private Sub Form_Load () '========================================================== ' Form: BLOWMAIN.FRM Procedure: Form_Load ' Author - Peter J. Morris. TMS Ltd. ' Template fitted: #### Date - 16/11/94 Time - 03:11 ' Copyright and status if any: Copyright TMS 1994,1995 ' All rights reserved. Status @BLUE@TMS.DEMO@COLD ' Purpose/Description In brief: ' Simple form initialisation. '========================================================= ' Set up general error handler On Error GoTo Error_Form_Load: ' ========== Code Starts.========== Const sHelpFile = "HELP.HLP" ' Center window in middle of screen. CenterWindow Me ' Make sure text fits in labels. DoLabels Me ' Sub-class this form using the message blaster control. ' Look for one message only. A WM_WINDOWPOSCHANGING message ' is sent to a window whose size, position, or z-order is ' about to change as a result of a call to SetWindowPos or ' another similar window management function. Note that we're ' going to get ahead of the message here. We want to know ' where the window is going before it gets there. MsgBlaster1.hWndTarget = Me.hWnd MsgBlaster1.MsgList(0) = WM_WINDOWPOSCHANGING MsgBlaster1.MsgPassage(0) = PREPROCESS ' No un-subclass stuff is done here - it's not necessary as the ' control handles it. ' Set up help file path etc. If Right$(App.Path, 1) <> "\" Then App.HelpFile = App.Path & "\" & sHelpFile Else App.HelpFile = App.Path & sHelpFile End If ' ========== Code Ends .========== Exit Sub ' Error handler Error_Form_Load: ' Call general error handler ErrorHandler "BLOWMAIN.FRM/Form_Load", Err, Error$ ' Default resume behaviour: exit this sub/func Resume Exit_Form_Load: Exit_Form_Load: End Sub '========================================================== ' Function - mnuHelpAbout_Click ' Author - Peter J. Morris. TMS Ltd. ' Date Written: #### Date - 16/11/94 Time - 03:11 ' Purpose - See function purpose. ' Revisions: ' BY WHY AFFECTED ' Peter J. Morris. TMS Ltd. Original code. ' INPUTS - None ' OUTPUTS - None '========================================================== Private Sub mnuHelpAbout_Click () '========================================================== ' Form: BLOWMAIN.FRM Procedure: mnuHelpAbout_Click ' Author - Peter J. Morris. TMS Ltd. ' Template fitted: #### Date - 16/11/94 Time - 03:11 ' Copyright and status if any: Copyright TMS 1994,1995 ' All rights reserved. Status @BLUE@TMS.DEMO@COLD ' Purpose/Description In brief: ' Produce simple 'About' message box. '========================================================= ' Set up general error handler On Error GoTo Error_mnuHelpAbout_Click: ' ========== Code Starts.========== MsgBox "'Blowup' was written by The Mandelbrot Set (Int'l) Ltd. for VBITS as a demonstration of how to access the Windows' API.", MB_OK Or MB_ICONINFORMATION, "About..." ' ========== Code Ends .========== Exit Sub ' Error handler Error_mnuHelpAbout_Click: ' Call general error handler ErrorHandler "BLOWMAIN.FRM/mnuHelpAbout_Click", Err, Error$ ' Default resume behaviour: exit this sub/func Resume Exit_mnuHelpAbout_Click: Exit_mnuHelpAbout_Click: End Sub '========================================================== ' Function - mnuHelpContents_Click ' Author - Peter J. Morris. TMS Ltd. ' Date Written: #### Date - 16/11/94 Time - 03:11 ' Purpose - See function purpose. ' Revisions: ' BY WHY AFFECTED ' Peter J. Morris. TMS Ltd. Original code. ' INPUTS - None ' OUTPUTS - None '========================================================== Private Sub mnuHelpContents_Click () '========================================================== ' Form: BLOWMAIN.FRM Procedure: mnuHelpContents_Click ' Author - Peter J. Morris. TMS Ltd. ' Template fitted: #### Date - 16/11/94 Time - 03:11 ' Copyright and status if any: Copyright TMS 1994,1995 ' All rights reserved. Status @BLUE@TMS.DEMO@COLD ' Purpose/Description In brief: ' Fire up help file on the contents page. '========================================================= ' Set up general error handler On Error GoTo Error_mnuHelpContents_Click: ' ========== Code Starts.========== Const HELP_CONTENTS = &H3 ' Start help file. If WinHelp(Me.hWnd, App.HelpFile, HELP_CONTENTS, 0) = 0 Then MsgBox "WinHelp cannot start the help file for some reason!", MB_OK, "Error" End If ' ========== Code Ends .========== Exit Sub ' Error handler Error_mnuHelpContents_Click: ' Call general error handler ErrorHandler "BLOWMAIN.FRM/mnuHelpContents_Click", Err, Error$ ' Default resume behaviour: exit this sub/func Resume Exit_mnuHelpContents_Click: Exit_mnuHelpContents_Click: End Sub '========================================================== ' Function - MsgBlaster1_Message ' Author - Peter J. Morris. TMS Ltd. ' Date Written: #### Date - 16/11/94 Time - 03:11 ' Purpose - See function purpose. ' Revisions: ' BY WHY AFFECTED ' Peter J. Morris. TMS Ltd. Original code. ' INPUTS - See Message Blaster documentation. ' OUTPUTS - See Message Blaster documentation. '========================================================== Private Sub MsgBlaster1_Message (MsgVal As Integer, wParam As Integer, lParam As Long, ReturnVal As Long) '========================================================== ' Form: BLOWMAIN.FRM Procedure: MsgBlaster1_Message ' Author - Peter J. Morris. TMS Ltd. ' Template fitted: #### Date - 16/11/94 Time - 03:11 ' Copyright and status if any: Copyright TMS 1994,1995 ' All rights reserved. Status @BLUE@TMS.DEMO@COLD ' Purpose/Description In brief: ' Sub-class a form window looking for a WM_WINDOWPOSCHANGING ' message to arrive. This message may cause the window to ' blowup! '========================================================= ' Set up general error handler 'On Error GoTo Error_MsgBlaster1_Message: ' ========== Code Starts.========== ' Used to hold our window's new screen position. Dim wp As WINDOWPOS ' Used for call to TMSExplodeForm. Dim rs As RECT ' #1 ' Get our window's new position by calling our custom DLL function. ' CopyWP1 is the function nGetWindowPos(). g_vDummy = CopyWP1(wp, lParam) ' #2 ' This would work but for the way in which this type of function ' typically works. CopyWP2 is the function lstrcpyn() ' g_vDummy = CopyWP2(wp, lParam, Len(wp)) ' #3 ' This WORKS! This is an 'undeclared' function (as so far as the Visual Basic docs go) ' and is normally used to copy a bit of memory from somewhere to somewhere else - perfect! ' CopyWP3 is the function hmemcpy(). ' CopyWP3 wp, lParam, Len(wp) ' Convert positional info to a rect. rs.Left = wp.X rs.Right = wp.CX + wp.X rs.Top = wp.Y rs.Bottom = wp.CY + wp.Y ' Explode us! TMSExplodeForm Me, rs, wp.Flags ' ========== Code Ends .========== Exit Sub ' Error handler Error_MsgBlaster1_Message: ' Call general error handler ErrorHandler "BLOWMAIN.FRM/MsgBlaster1_Message", Err, Error$ ' Default resume behaviour: exit this sub/func Resume Exit_MsgBlaster1_Message: Exit_MsgBlaster1_Message: End Sub